<?php
namespace app\space\controller;
use app\common\controller\TyCheck;
use app\space\logic\BaseLogic;
use think\Controller;

/**
 * 基础控制器
 * Created by PhpStorm.
 * User: tyll
 * Date: 2019/09/25
 * Time: 09:20
 */
class Base extends Controller {

    use TyCheck;

    public function __construct(){
        parent::__construct();
        $this->b_logic = new BaseLogic();
    }

    /**
     * 获取社区巡店联动
     * @return \think\response\Json
     */
    public function ajax_get_cp_linkage(){
        $list = [];
        $maps = [];
        $b_list = model('branch')->get_list($maps,'id,name');
        foreach($b_list as $k_1 => $v_1){
            $list[$k_1] = $v_1->toArray();

            $f_maps = [];
            $f_maps[] = ['branchid','=',$v_1['id']];
            $f_list = model('floor')->get_list($f_maps,'id,name');
            $list[$k_1]['f_list'] = $f_list;
        }

        $data['list'] = $list;
        return json($this->b_logic->get_response(1,'OK',$data));
    }
}